<template>
  <div v-if="Object.keys(goods).length!==0" class="base-info">
    <div class="info-title">{{ goods.title }}</div>
    <div class="info-price">
      <span class="n-price">{{ goods.newPrice }}</span>
      <span class="o-price">{{ goods.oldPrice }}</span>
      <span v-if="goods.discount"
            class="discount">{{ goods.discount }}</span>
    </div>
    <div class="info-other">
      <span>{{ goods.columns[0] }}</span>
      <span>{{ goods.columns[1] }}</span>
      <span>{{ goods.services[goods.services.length-1].name }}</span>
    </div>
    <div class="info-service">
      <span class="info-service-item"
            v-for="index in goods.services.length-1" :key="index">
        <i :class="goods.services[index-1].icon"></i>
        <span>{{ goods.services[index-1].name }}</span>
      </span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "",
    props: {
      goods: {
        type: Object,
        default(){
          return {}
        }
      }
    }
  }
</script>

<style lang="less" scoped>
.base-info{
  border-bottom: 3px solid #eee;
  padding: 8px;
  .info-title{
    font-size: 16px;
    line-height: 18px;
    font-weight: bold;
    color: black;
  }
  .info-price{
    margin: 18px 0;
    .n-price{
      font-size: 22px;
      color: var(--color-high-text);
    }
    .o-price{
      text-decoration: line-through;
      font-size: 14px;
      margin: 0 4px;
    }
    .discount{
      font-size: 13px;
      padding: 3px 5px;
      background-color: var(--color-tint);
      color: white;
      border-radius: 20px;
      vertical-align: top;
      font-weight: bold;
    }
  }
  .info-other{
    display: flex;
    font-size: 14px;
    justify-content: space-between;
    padding: 8px 2px;
    border-bottom: 1px solid #eee;
  }
  .info-service{
    padding: 15px 3px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    i{
      font-size: 12px;
      vertical-align: middle;
      color: var(--color-tint);
      margin-right: 1px;
    }
    span{
      vertical-align: middle;
    }
  }
}
</style>
